﻿using System;

namespace gbL.NetBoard.Filters
{
    public class MessageTypeFilter : IEntryFilter<Type>
    {
        private TypeAssignableFilter _innerFilter = new TypeAssignableFilter();

        public void AddFilter(object owner, Type toFilter)
        {
            _innerFilter.AddFilter(owner, toFilter);
        }

        public void Precalculate(IBlackboardEntry toTest)
        {
            // not needed
        }

        public bool HasFilter(object owner)
        {
            return _innerFilter.HasFilter(owner);
        }

        public bool IsAllowed(object owner, IBlackboardEntry toTest)
        {
            return _innerFilter.IsAllowed(owner, toTest.MessageType);
        }
    }
}
